package com.bjsxt.chapter3_builder;

/**
 * @ClassName SxtAirShipDirector
 * @Description 尚学堂牌宇宙飞船装配器
 * @Author 黑马程序员
 * @Date 18:19 2024/6/20
 * @Version 1.0
 **/
public class SxtAirShipDirector implements AirShipDirector{

    private AirShipBuilder builder;

    public SxtAirShipDirector(AirShipBuilder builder) {
        this.builder = builder;
    }

    @Override
    public AirShip directAirShip() {
        Engine engine = builder.builderEngine();
        OrbitalModule orbitalModule = builder.builderOrbitalModule();
        EscapeTower escapeTower = builder.builderEscapeTower();

        // 装配成飞船对象
        AirShip airShip = new AirShip();
        airShip.setEngine(engine);
        airShip.setOrbitalModule(orbitalModule);
        airShip.setEscapeTower(escapeTower);
        return airShip;
    }
}
